package demo02;


import java.util.ArrayList;
import java.util.List;

public class ConcreteCompany extends Company {
private List <Company> children = new ArrayList();

    public ConcreteCompany(String name) {
        super(name);
    }

    @Override
    public void Add(Company c) {
        children.add(c);

    }

    @Override
    public void Remove(Company c) {
children.remove(c);
    }

    @Override
    public void Disppay(int depth) {
        System.out.println("-"+depth+name);
        for (Company c :children) {
            c.Disppay(depth+2);
            for(int i=0;i<depth;i++){
                System.out.print("--");
            }

        }
    }

    @Override
    public void LineOfDuty() {
        for (Company c :children) {

           c.LineOfDuty();

        }
    }
}
